const hasPermission = {
    install(Vue, options) {
        Vue.directive('hasPermission', {
            bind(el, binding, vnode) {
                let permissionList = vnode.context.$route.meta.permission;
                if (permissionList && permissionList.length && !permissionList.includes(binding.value)) {
                    if (el.parentNode) {
                        el.parentNode.removeChild(el);
                    } else {
                        el.remove();
                    }
                }
            }
        });
    }
};

export default hasPermission;
